In [14]:
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
from gtts import gTTS
import matplotlib
import numpy
from traitlets.config.manager import BaseJSONConfigManager
path = "/Users/scot/anaconda3/envs/py36/etc/jupyter/nbconfig"
cm = BaseJSONConfigManager(config_dir=path)
cm.update("livereveal", {"autolaunch": True,
"theme": "sky",
}
)
#Supress default INFO logging
# The UT Dallas Art Science Lab Training module
print ('The UTDallas ArtSci Lab Sonification')
print(' "Half-Empty/Half-Full" Training Module.')
print("\n")
print("Here are the instructions for those unfamiliar with these sonification training modules" )
print("\n Basic Instructions for each cell :")
print('1. Press "Shift + Enter" at every new cell to initiate display/execute that cell')
print("2. Hit the Space Bar to go to next section (cell)")
print("\n")
print("These are the two main actions that you need to move forward, cell by cell in each unit")
print("This is how this system functions")
print("Do these now")
In [ ]:
import random
from gtts import gTTS
import time
from IPython.display import Image, display, clear_output
from ipywidgets import widgets
import os
import platform
speechflag = 0
if (platform.system()=='Windows'):
speechflag = 2
if (platform.system()!='Windows'):
speechflag = 1
display(Image('dep/images/glasses.jpg'))
tts = gTTS(text=('In this sonification,we try to represent the emptiness or fullness of something. For instance a drop of water falling into an empty glass sounds like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
os.system("dep/audio/afplay num.mp3")
os.system("dep/audio/afplay empty.mp3")
if (speechflag==2):
os.system("cmdmp3 dep/audio/num.mp3")
os.system("cmdmp3 dep/audio/empty.mp3")
tts = gTTS(text=('Or the same drop of water falling into a full glass might sound like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
os.system("afplay dep/audio/num.mp3")
os.system("afplay dep/audio/full.mp3")
if (speechflag==2):
os.system("cmdmp3 dep/audio/num.mp3")
os.system("cmdmp3 dep/audio/full.mp3")
tts = gTTS(text=('Notice, as how the saying goes, it is difficult to say if a glass is half empty '), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
os.system("afplay dep/audio/num.mp3")
os.system("afplay half_empty.mp3")
if (speechflag==2):
os.system("cmdmp3 dep/audio/num.mp3")
os.system("cmdmp3 dep/audio/half_empty.mp3")
tts = gTTS(text=('or half full '), lang='en')
tts.save("num.mp3")
if (speechflag==1):
os.system("afplay dep/audio/num.mp3")
os.system("afplay dep/audio/half_full.mp3")
if (speechflag==2):
os.system("cmdmp3 dep/audio/num.mp3")
os.system("cmdmp3 dep/audio/half_full.mp3")
tts = gTTS(text=('Ok. Hit space bar to go to the next section where you can explore this sonification (before taking the test)'), lang='en')
tts.save("num.mp3")
if (speechflag==1):
os.system("afplay dep/audio/num.mp3")
if (speechflag==2):
os.system("cmdmp3 dep/audio/num.mp3")
In [ ]:
## Time to move onto the Exploration Module
Now that you have the general idea of this straight forward sound representation.
It is time to move on to the next phase of exploring the sonification.
Go back to the list of available notebooks and select "Full or Empty Exploration Module"